* Replicatioon do file for/// 
/// Citi, Manuele and Mogens K. Justesen (2014). "Measuring and explaining regulatory reform in the EU: A time-series analysis of eight sectors, 1984�2012"///
/// European Journal of Polical Research 53(4), 709-726. 
* Use file: "Citi_Justesen_EJPR2014_replication_data.dta"


tsset year, yearly

****************************************************************************
****************************************************************************

***** Figures 1-3

****************************************************************************
****************************************************************************

* Figure 1: Use file "Citi_Justesen_Regulatory_data.dta"

* Figure 2: Density plot: All sectors collapsed (total time series)
kdensity total, title(Figure 2. Density of Regulatory Changes) subtitle(1984-2012) note(Note: X-axis is the count of regulatory changes)

* Figure 3: Time series plot: All sectors collapsed (total time series)
twoway (tsline total, recast(area)), ytitle(Total Regulatory Changes) ttitle(Year) ///
title(Figure 3. Changes in Regulatory Density by Year) subtitle(1984-2012) note(Note: Y-axis is the count of regulatory changes (all sectors))


****************************************************************************
****************************************************************************

***** Table 1: Regulatory change in the EU, 1984-2012

****************************************************************************
****************************************************************************

***** Panel A: Negative binomial regressions
** Without leg_proposals (potentially endogenous)
* #1
nbreg total Codecision_II EU_membership w100, irr
nbreg total Codecision_II EU_membership w100, r irr
outreg2 using table1, word append tstat bdec(3) tdec(2) eform

* Autocorrelation test 
	* 1) Run regression using glm model with nbreg family and log link
	glm total Codecision_II EU_membership w100, family(nb) link(log) vce(robust)
	* 2) Obtain residuals: Here 'response residuals', which are 'normal' residuals (i.e. difference between observed and expected counts). 
	predict res, response
	* 3a) Test autocorrelation using Portmanteau (Q) test for residuals
	wntestq res, lag(1)
	* 3b) Check with regression of current on lagged residuals
	reg res l.res
	drop res

* #2
nbreg total Codecision_II EU_membership w100 mean_R_com mean_R_couW mean_R_epW, irr
nbreg total Codecision_II EU_membership w100 mean_R_com mean_R_couW mean_R_epW, r irr
outreg2 using table1, word append tstat bdec(3) tdec(2) eform

* Autocorrelation test 
	* 1) Run regression using glm model with nbreg family and log link
	glm total Codecision_II EU_membership w100 mean_R_com mean_R_couW mean_R_epW, family(nb) link(log) vce(robust)
	* 2) Obtain residuals: Here 'response residuals', which are 'normal' residuals (i.e. difference between observed and expected counts). 
	predict res, response
	* 3a) Test autocorrelation using Portmanteau (Q) test for residuals
	wntestq res, lag(1)
	* 3b) Check with regression of current on lagged residuals
	reg res l.res
	drop res
	

* #3: Most extreme Ideological distance (absolute), Kluever/Sargazazu data (EUP)
nbreg total Codecision_II EU_membership w100 diff_xtremes_SQR, irr
nbreg total Codecision_II EU_membership w100 diff_xtremes_SQR, r irr
outreg2 using table1, word append tstat bdec(3) tdec(2) eform

* Autocorrelation test 
	* 1) Run regression using glm model with nbreg family and log link
	glm total Codecision_II EU_membership w100 diff_xtremes_SQR, family(nb) link(log) vce(robust)
	* 2) Obtain residuals: Here 'response residuals', which are 'normal' residuals (i.e. difference between observed and expected counts). 
	predict res, response
	* 3a) Test autocorrelation using Portmanteau (Q) test for residuals
	wntestq res, lag(1)
	* 3b) Check with regression of current on lagged residuals
	reg res l.res
	drop res

* #4: Commision president dummies: Barroso is reference category 
nbreg total Codecision_II EU_membership w100 thorn-prodi, irr
nbreg total Codecision_II EU_membership w100 thorn-prodi, r irr
outreg2 using table1, word append tstat bdec(3) tdec(2) eform

* Autocorrelation test 
	* 1) Run regression using glm model with nbreg family and log link
	glm total Codecision_II EU_membership w100 thorn-prodi, family(nb) link(log) vce(robust)
	* 2) Obtain residuals: Here 'response residuals', which are 'normal' residuals (i.e. difference between observed and expected counts). 
	predict res, response
	* 3a) Test autocorrelation using Portmanteau (Q) test for residuals
	wntestq res, lag(1)
	* 3b) Check with regression of current on lagged residuals
	reg res l.res
	drop res

	
	
** With leg_proposals. Note because of lag, we loose one observation; therefore, Thorn cannot be included in model 10. 
* #5
nbreg total Codecision_II EU_membership w100 l.leg_proposals, irr
nbreg total Codecision_II EU_membership w100 l.leg_proposals, r irr
outreg2 using table1, word append tstat bdec(3) tdec(2) eform

* Autocorrelation test 
	* 1) Run regression using glm model with nbreg family and log link
	glm total Codecision_II EU_membership w100 l.leg_proposals, family(nb) link(log) vce(robust)
	* 2) Obtain residuals: Here 'response residuals', which are 'normal' residuals (i.e. difference between observed and expected counts). 
	predict res, response
	* 3a) Test autocorrelation using Portmanteau (Q) test for residuals
	wntestq res, lag(1)
	* 3b) Check with regression of current on lagged residuals
	reg res l.res
	drop res

* #6
nbreg total Codecision_II EU_membership w100 mean_R_com mean_R_couW mean_R_epW l.leg_proposals, irr
nbreg total Codecision_II EU_membership w100 mean_R_com mean_R_couW mean_R_epW l.leg_proposals, r irr
outreg2 using table1, word append tstat bdec(3) tdec(2) eform

* Autocorrelation test 
	* 1) Run regression using glm model with nbreg family and log link
	glm total Codecision_II EU_membership w100 mean_R_com mean_R_couW mean_R_epW l.leg_proposals, family(nb) link(log) vce(robust)
	* 2) Obtain residuals: Here 'response residuals', which are 'normal' residuals (i.e. difference between observed and expected counts). 
	predict res, response
	* 3a) Test autocorrelation using Portmanteau (Q) test for residuals
	wntestq res, lag(1)
	* 3b) Check with regression of current on lagged residuals
	reg res l.res
	drop res
	

* #7: Most extreme Ideological distance (absolute), Kluever/Sargazazu data (EUP)
nbreg total Codecision_II EU_membership w100 diff_xtremes_SQR l.leg_proposals, irr
nbreg total Codecision_II EU_membership w100 diff_xtremes_SQR l.leg_proposals, r irr
outreg2 using table1, word append tstat bdec(3) tdec(2) eform

* Autocorrelation test 
	* 1) Run regression using glm model with nbreg family and log link
	glm total Codecision_II EU_membership w100 diff_xtremes_SQR l.leg_proposals, family(nb) link(log) vce(robust)
	* 2) Obtain residuals: Here 'response residuals', which are 'normal' residuals (i.e. difference between observed and expected counts). 
	predict res, response
	* 3a) Test autocorrelation using Portmanteau (Q) test for residuals
	wntestq res, lag(1)
	* 3b) Check with regression of current on lagged residuals
	reg res l.res
	drop res

* #8: Commision president dummies: Barroso is reference category 
nbreg total Codecision_II EU_membership w100 thorn-prodi l.leg_proposals, irr
nbreg total Codecision_II EU_membership w100 thorn-prodi l.leg_proposals, r irr
outreg2 using table1, word append tstat bdec(3) tdec(2) eform

* Autocorrelation test 
	* 1) Run regression using glm model with nbreg family and log link
	glm total w100 EU_membership Codecision_II thorn-prodi l.leg_proposals, family(nb) link(log) vce(robust)
	* 2) Obtain residuals: Here 'response residuals', which are 'normal' residuals (i.e. difference between observed and expected counts). 
	predict res, response
	* 3a) Test autocorrelation using Portmanteau (Q) test for residuals
	wntestq res, lag(1)
	* 3b) Check with regression of current on lagged residuals
	reg res l.res
	drop res




****************************************************************************
****************************************************************************

***** Table 1 end 

****************************************************************************
****************************************************************************




****************************************************************************
****************************************************************************

***** Appendix A2: OLS regressions: log(total) is dependent variable

****************************************************************************
****************************************************************************
	
** Without leg_proposals (potentially endogenous)
* #1
reg logtotal Codecision_II EU_membership w100, r
outreg2 using tableA, word append tstat bdec(3) tdec(2)

* Autocorrelation (AC) test
reg logtotal Codecision_II EU_membership w100
estat durbinalt, small
estat bgodfrey

* #2
reg logtotal Codecision_II EU_membership w100 mean_R_com mean_R_couW mean_R_epW, r
outreg2 using tableA, word append tstat bdec(3) tdec(2)

* Autocorrelation (AC) test
reg logtotal Codecision_II EU_membership w100 mean_R_com mean_R_couW mean_R_epW, 
estat durbinalt, small
estat bgodfrey

* #3: Most extreme Ideological distance (absolute), Kluever/Sargazazu data (EUP)
reg logtotal Codecision_II EU_membership w100 diff_xtremes_SQR, r
outreg2 using tableA, word append tstat bdec(3) tdec(2)

* Autocorrelation (AC) test
reg logtotal Codecision_II EU_membership w100 diff_xtremes_SQR, 
estat durbinalt, small
estat bgodfrey

* #4: Commision president dummies: Barroso is reference category 
reg logtotal Codecision_II EU_membership w100 thorn-prodi, r
outreg2 using tableA, word append tstat bdec(3) tdec(2)

* Autocorrelation (AC) test
reg logtotal Codecision_II EU_membership w100 thorn-prodi, 
estat durbinalt, small
estat bgodfrey



** With leg_proposals. Note because of lags, we loose one observation; therefore, Thorn cannot be included in model 10. 
* #5
reg logtotal Codecision_II EU_membership w100 l.leg_proposals, r
outreg2 using tableA, word append tstat bdec(3) tdec(2)

* Autocorrelation (AC) test
reg logtotal Codecision_II EU_membership w100 l.leg_proposals
estat durbinalt, small
estat bgodfrey

* #6
reg logtotal Codecision_II EU_membership w100 mean_R_com mean_R_couW mean_R_epW l.leg_proposals, r
outreg2 using tableA, word append tstat bdec(3) tdec(2)

* Autocorrelation (AC) test
reg logtotal Codecision_II EU_membership w100 mean_R_com mean_R_couW mean_R_epW l.leg_proposals, 
estat durbinalt, small
estat bgodfrey

* #7: Most extreme Ideological distance (absolute), Kluever/Sargazazu data (EUP)
reg logtotal Codecision_II EU_membership w100 diff_xtremes_SQR l.leg_proposals, r
outreg2 using tableA, word append tstat bdec(3) tdec(2)

* Autocorrelation (AC) test
reg logtotal Codecision_II EU_membership w100 diff_xtremes_SQR l.leg_proposals, 
estat durbinalt, small
estat bgodfrey

* #8: Commision president dummies: Barroso is reference category 
reg logtotal Codecision_II EU_membership w100 thorn-prodi l.leg_proposals, r
outreg2 using tableA, word append tstat bdec(3) tdec(2)

* Autocorrelation (AC) test
reg logtotal Codecision_II EU_membership w100 thorn-prodi l.leg_proposals, 
estat durbinalt, small
estat bgodfrey


****************************************************************************
****************************************************************************

***** Appendix A2 end 

****************************************************************************
****************************************************************************

